<%@ Page Language="C#" AutoEventWireup="true" Inherits="Syrinx.Gui.AspNet.Nitobi2.NitobiBasePage" 
	 MasterPageFile="~/App_ThemeMasters/NoStyle/popUpTwoColumnLayout.Master" %>
<%@ Register Assembly="Swaf.Gui.AspNet2" Namespace="Swaf.Gui.AspNet2" TagPrefix="swf" %>
<%@ Register Assembly="Syrinx.Gui.AspNet.Nitobi2" Namespace="Syrinx.Gui.AspNet.Nitobi2" TagPrefix="snc" %><%@ Register Assembly="NitobiControls" Namespace="Nitobi" TagPrefix="ntb" %>

<asp:Content ContentPlaceHolderID="title" ID="c01" runat="server">
 <div class="left"><h1><asp:Label ID="ImgCacheLibLbl" runat="server" > Image Cache Library</asp:Label></h1></div>
<swf:BizProc ID="settings" runat="server" FactoryName="mediaCache">
</swf:BizProc>

 <swf:BizProc runat="server" ID="adl" factoryName="mediaDirectoryLibrary">
	<State entireTree="false" EditModeSessionKey="GlobalEdit" includeSelf="true" />
	<ParentBizProc id="settings" fieldName="id" dataId="pid" />
</swf:BizProc>
<swf:BizProc runat="server" ID="ail" FactoryName="mediaImagesLibrary">
	<ParentBizProc id="adl" fieldName="keyName" dataId="pid" />
	<ParentBizProc id="settings" fieldName="id" dataId="cid" />
</swf:BizProc>
<swf:BizProc ID="cachScl" runat="server" FactoryName="cacheScalings">
	<ParentBizProc id="settings" fieldName="scalings" dataId="parent" fullDependency="True" />
</swf:BizProc>
<swf:BizProc ID="sclSet" runat="server" FactoryName="scalingSettings">
	<ParentBizProc id="cachScl" fieldName="adjustments" dataId="parent" fullDependency="True" cacheValue="false" />
</swf:BizProc>
</asp:Content>

<asp:Content ContentPlaceHolderID="leftContent" ID="c02" runat="server">
	<asp:Label runat="server" ID="cachlistLbl" Text="Company Image Caches:" />
	<snc:Combo ID="caches" runat="server" ParentBizProcIds="settings" DataTextField="name">
		<Columns>
			<ntb:BoundColumn DataField="id" Visible="false" />
			<ntb:BoundColumn DataField="name" HeaderText="Name" width="200" />
		</Columns>
	</snc:Combo>
	<snc:Grid ID="articleList1Display" runat="server" Width="273px" Height="425px" Resizable="Both" ShowToolbar="false" ParentBizProcIds="adl" Mode="LiveScrolling">
		<Columns>
			<ntb:KeyColumn DataField="keyName"  />
			<ntb:BoundColumn DataField="depthName" HeaderText="Name" width="200" />
			<ntb:NumberColumn DataField="fileCount" HeaderText="Num Files" width="56" Mask="#,###" />
			<ntb:BoundColumn DataField="xx" Width="40" />
		</Columns>
	</snc:Grid>
	
	<swf:BizProc runat="server" ID="ap" FactoryName="actionParam">
		<ParentBizProc id="ail" fieldName="name" dataId="pid" />
	</swf:BizProc>
		
</asp:Content>
<asp:Content ContentPlaceHolderID="rightContent" ID="c03" runat="server">
<ntb:TabStrip runat="server" id="tabs" Width="300" Height="600">
	<AutoSize FixedHeightMargin="65" FixedWidthMargin="5" MarginWidthDomId="leftArea" />
	<TabItems>
		<ntb:TabItem NamedId="ta1" Name="Images" width="125" />
		<ntb:TabItem Name="Upload" NavigationUrl="ImageUploadPopupChild.aspx" width="125" />
	</TabItems>
</ntb:TabStrip>
		<div id="ta1">
	        <snc:ComplexBizObjListDisplay runat="server" ID="miImages" 
		        ReadOnlyTemplate="MediaCache.Gui.AspNet.ImagesListDisplay-ClientSelect" 
		        ParentBizProcIds="ail">
		        <macros>
			        <Entry name="navLink" type="String">imageviewer.aspx</Entry>
		        </macros>
	        </snc:ComplexBizObjListDisplay>
		</div>
</asp:Content>
<asp:Content ContentPlaceHolderID="buttons" ID="c04" runat="server">
	<div style="float:right;">
		<script type="text/javascript">
			var cacheName = "";
			var selectedImage = "";
			var imageSize="Thumbnail";
			var width = null, height = null;
		</script>
		<table><tr><td>
		<span style="width:25px"></span>
		<asp:Label runat="server" id="_sizeLbl" Text="Scaling Size:"></asp:Label>
		</td><td>
			<snc:Combo ID="scalings" runat="server" ParentBizProcIds="sclSet" DataTextField="name" Mode="Classic">
				<ClientEvents Select="imageSize = this.GetSelectedRowValues()[0]; width = this.GetSelectedRowValues()[2]; height= this.GetSelectedRowValues()[3];" />
				<TextBox Width="200" />
				<List Width="360" Height="150" />
				<Columns>
					<ntb:BoundColumn DataField="name" Visible="false" />
					<ntb:BoundColumn DataField="name" HeaderText="Name" width="200" />
					<ntb:BoundColumn DataField="width" HeaderText="Width" Width="75" />
					<ntb:BoundColumn DataField="height" HeaderText="Height" Width="75" />
				</Columns>
			</snc:Combo>
		</td><td>
			<script language="javascript">
				function insertImage()
				{
					if(cacheName == '') 
						window.returnValue = false;
					else if(imageSize == '_origional' || (imageSize.length > "Video".length && imageSize.substr(imageSize.length - "Video".length)  == "Video"))
						window.returnValue = ["Video",width,height, "mms://localhost:8089/filesys/PublicVideos/" + selectedImage.substr(0, selectedImage.length - '.image'.length),'/' + cacheName + '/' + imageSize.substr(0,imageSize.length - "Video".length) + '/' + selectedImage];
					else
						window.returnValue = ["Image",width,height,'/' + cacheName + '/' + imageSize + '/' + selectedImage,null];
					//alert(window.returnValue);
					window.close();
				}
			</script>
			<button onclick="insertImage();" type="button">Insert</button>
		</td></tr></table>

	</div>
</asp:Content>

